package com.sbck.cs3.fragment;

import android.content.Intent;
import android.os.Bundle;

import android.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import androidx.annotation.Nullable;

import com.sbck.cs3.MainActivity;
import com.sbck.cs3.MyGlobal;
import com.sbck.cs3.R;

public class DebugLoginFragment extends Fragment {


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_debug_login, container, false);
    }
    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        Button buttonWifi = view.findViewById(R.id.Btn_DebugLoginFragment_WIFI);
        buttonWifi.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MyGlobal.setting.IsWifi.set(true);
                MyGlobal.setting.ServerIp.set("192.168.1.1");
                MyGlobal.ServerPort = 9999;

                Intent intent = new Intent();
                intent.setClass(getActivity(), MainActivity.class);
                startActivity(intent);
            }
        });

        Button button4G = view.findViewById(R.id.Btn_DebugLoginFragment_4G);
        button4G.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                MyGlobal.setting.IsWifi.set(false);
                MyGlobal.setting.ServerIp.set("47.104.227.30");
                MyGlobal.ServerPort = 9994;
                Intent intent = new Intent();
                intent.setClass(getActivity(), MainActivity.class);
                startActivity(intent);
            }
        });

    }

}